#include <REGX52.H>
#include <intrins.h>
void TimeInit()
{
	TMOD=0x01;
	TH0=(65536-50000)/256;
	TL0=(65536-50000)%256;
	TH1=(8192-2000)/32;			
	TL1=(8192-2000)%32;			
	ET0=1;
	ET1=1;
	EA=1;
	TR1=1;
	TR0=1;
}
int j=0;
int count=0;
int i=0;
void main()
{
	TimeInit();
	while(1)
	{
	
	}
}

void timer0() interrupt 1
{
	int tab[]={0x01,0x02,0x04,0x08,0x10,0x20,0x40,0x80};
	TH0=(65536-50000)/256;
	TL0=(65536-50000)%256;
	
	if(i%2==0)
	{
		P2_0=~P2_0;
	}	
	i++;
	
	if(count<16)
	{
		P1=tab[count/2];
	}else{
		count=0;
	}
   count++;
}
	
void timer1() interrupt 3
{	
	TH1=(8192-2000)/32;
	TL1=(8192-2000)%32;
	j++;
	if(j==10)
	{
		P2_1=0;
	}
	if(j==50)
	{
		P2_1=1;
		j=0;
	}
}
	
